<extend name="Public:index" />
<block name="mycss">
  <link href="__PUBLIC__/assets/plugins/dropify/css/dropify.min.css" rel="stylesheet">
  <link href="__PUBLIC__/assets/plugins/datatables/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
   <link rel="stylesheet" href="__PUBLIC__/assets/plugins/jquery-editable-select/jquery-editable-select.min.css" />
</block>
<block name="main-content">
  <iframe name="ajaxifr" style="display:none;"></iframe>
  <div class="container-fluid">
    <form id="signupForm" class="form-horizontal my-4" method="post" action="__ACTION__" autocomplete="off" target="ajaxifr">

    <div class="row">
          <div class="col-lg-10">
              <div class="form-group row">
                <label class="col-sm-2 col-form-label text-right" for="username">我的头像</label>
                <div class="input-group col-sm-4">
                    <input type="file" onchange="onUpload()"  name= "input-file" id="input-file" class="dropify" data-default-file="__ROOT__{$data.image_url}" />
                </div>
              </div>
              <div class="form-group row">
                <label class="col-sm-2 col-form-label text-right" for="username">用户名称</label>
                <div class="input-group col-sm-6">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon1"><i class="mdi mdi-account-outline font-16"></i></span>
                  </div>
                  
                  <input type="text" value="{$data.username}" disabled="true" class="form-control" id="username" name="username" placeholder="用户名称">
                </div>
              </div>
              
              <div class="form-group row">
                <label class="col-sm-2 col-form-label text-right" for="Email">Email</label>
                <div class="input-group col-sm-6">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon1"><i class="mdi mdi-email-outline font-16"></i></span>
                  </div>
                  <input type="text" value="{$data.email}" class="form-control" id="email" name="email" placeholder="邮件地址">
                </div>
              </div>


              <div class="form-group row">
                <label class="col-sm-2 col-form-label text-right" for="company">公司名称</label>
                <div class="input-group col-sm-6">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon2"><i class="mdi mdi-office-building font-16"></i></span>
                  </div>
                  <select class="form-control" id="company" name="company"  placeholder="公司名称">
                       <volist name="companys" id="company_name" key="k">
                        <option <if condition="$data['company'] eq $company_name">selected</if>>{$company_name}</option>
                       </volist>
                    </select>
                  
                </div>
              </div>
           
              <div class="form-group row">
                <label class="col-sm-2 col-form-label text-right" for="phone">电话号码</label>
                <div class="input-group col-sm-6">
                  <div class="input-group-prepend">
                    <span class="input-group-text" id="basic-addon5"><i class="mdi mdi-cellphone-iphone font-16"></i></span>
                  </div>
                  <input type="text" value="{$data.phone}" class="form-control" id="phone" name="phone" placeholder="电话号码">
                </div>
              </div>

              <div class="form-group row">
                <div class="col-12 mt-2">
                 <input type="hidden" value="{$data.userid}"  id="userid" name="userid" >
                
                  <button type="submit" class="btn btn-primary  waves-effect waves-light px-5">修改</button>
              
                </div>
              </div>
          </div>
      
    </div>
    </form>
  </div>
   
          
</block>
<block name="myscript">
  <script src="__PUBLIC__/assets/plugins/dropify/js/dropify.min.js"></script>
  <script src="__PUBLIC__/assets/plugins/upload/ajaxfileupload.js"></script>
   <script src="__PUBLIC__/assets/plugins/jquery-editable-select/jquery-editable-select.min.js"></script>
   <script src="__PUBLIC__/assets/js/jquery.validate.js"></script>
    <script src="__PUBLIC__/assets/js/messages_zh.js"></script>
  <script src="__PUBLIC__/assets/plugins/toast/jquery.toast.min.js"></script>
  <script>
  $('#company').editableSelect();
  
  $('.dropify').dropify({
      messages: {
        'default': '点击或拖拽文件到这里',
        'replace': '点击或拖拽文件到这里来替换文件',
        'remove':  '移除文件',
        'error':   '对不起，你上传的文件太大了',
   } 
  
  });
  function onUpload(){
     var url = "{:U('Web/Profile/upload')}";
     $.ajaxFileUpload({
        url: url, 
        type: 'post',
        secureuri: false, //一般设置为false
        fileElementId: "input-file", // 上传文件的name属性名
        dataType: 'text', //返回值类型，一般设置为json
        success: function(data){
           

        },
        error: function(data, status, e){ 
            alert(e);
            console.log(data);
        }
    });
  } 
    

  </script>
</block>